#include <QApplication>
#include <QDebug>
#include <QSplashScreen>
#include <QTime>
#include <QDesktopWidget>
#include <QGraphicsView>

#include "desktop/desktopresource.h"
#include "ktv/model/resource/resource.h"
#include "gui.h"
#include "scene.h"

int main(int argc, char *argv[])
{
    qDebug() << "Hello, qDebug(): " << endl;

    QApplication app(argc, argv);
    qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));

    QSplashScreen *splash = new QSplashScreen;
    splash->setPixmap(QPixmap("../VisualSoft_resource/image/ktv/loading.png"));
    splash->show();

    DesktopResource::getInstance();
    Resource::getInstance();

    GUI *gui = new GUI();

    QDesktopWidget *desktop = QApplication::desktop();
    QRect screen = desktop->screenGeometry();
    Scene scene(gui, screen.width(), screen.height());

    QGraphicsView view(&scene);
    view.setWindowTitle("KTV");
    view.setRenderHint(QPainter::Antialiasing);
    view.setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
//    view.setWindowState(Qt::WindowMaximized);
//    view.setWindowState(Qt::WindowFullScreen);

    view.show();

    splash->finish(&view);
    delete splash;

    return app.exec();
}
